//
//  MarketController.m
//  CenturyCity
//
//  Created by beisheng03 on 2017/11/21.
//  Copyright © 2017年 beisheng. All rights reserved.

#import "MarketController.h"
#import "MarketHomeCell.h"
#import "WineCategoryVC.h"
@interface MarketController ()
@property (nonatomic, strong) NSArray *dataModels;
@end

@implementation MarketController


- (NSArray *)dataModels{
    if (!_dataModels) {
        _dataModels = @[@{@"image" : @"http://mall.xjscvip.com/data/upload/mobile/special/s0/s0_05531746494804292.jpg",@"title" : @"水",@"subTitle" : @"畅饮钓鱼岛 坚定爱国心"},
                       @{@"image" : @"http://image.9bianli.com:33/Files/A01/Image/OtherResource/913A3791-8E22-4ABF-A75C-4218541E4808.jpg",@"title" : @"白酒",@"subTitle" : @"香醇淡雅 与君子同饮"},
                       @{@"image" : @"http://image.9bianli.com:33/Files/A01/Image/OtherResource/5F727CE1-40EF-49AC-ABEA-F873D67580F8.jpg",@"title" : @"啤酒",@"subTitle": @"纯正进口啤酒 给你更好的味道"},
                       @{@"image" : @"http://image.9bianli.com:33/Files/A01/Image/OtherResource/A03449C2-0A51-4AA7-B851-218DD91B9A05.jpg",@"title" : @"葡萄酒",@"subTitle" : @"果香浓郁 来自名庄的精挑细选"},
                       @{@"image" : @"http://image.9bianli.com:33/Files/A01/Image/OtherResource/2D4749CD-8135-4EA1-BE85-F83B9CDE6E93.jpg",@"title" : @"洋酒",@"subTitle" : @"不一样的格调 别样生活"},
                       @{@"image" : @"http://image.9bianli.com:33/Files/A01/Image/OtherResource/1BE03444-25D9-4FD3-809E-DFE0F545BB15.jpg",@"title" : @"黄酒",@"subTitle" : @"传承千年 好酒养身"},
                        @{@"image" : @"http://image.9bianli.com:33/Files/A01/Image/OtherResource/78DDE707-F2B2-474E-AFF3-E5187107F87C.jpg",@"title" : @"饮料",@"subTitle" : @"更好的水 给更好的自己"}];
    }



    
    
    return _dataModels;
}

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.plainTableView.tableFooterView = [[UIView alloc]init];
    
    self.plainTableView.backgroundColor = [UIColor whiteColor];
    
    
    
     [self.plainTableView registerNib:[UINib nibWithNibName:NSStringFromClass([MarketHomeCell class]) bundle:nil] forCellReuseIdentifier:[MarketHomeCell identifierStr]];
    
    
    // 设置标题
    if (@available(iOS 11.0, *)) {
        
        self.navigationController.navigationBar.prefersLargeTitles = YES;
        self.navigationItem.largeTitleDisplayMode =  UINavigationItemLargeTitleDisplayModeAlways;
        
         self.navigationItem.searchController = [[UISearchController alloc] initWithSearchResultsController:nil];
        
        self.navigationItem.hidesSearchBarWhenScrolling = NO;
    }
    
    
    // Do any additional setup after loading the view.
}


- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
    
    return 1;
}


- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    
    return  7;
}


- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    
    
        MarketHomeCell *cell = [tableView dequeueReusableCellWithIdentifier:[MarketHomeCell identifierStr]];
    
        cell.data = self.dataModels[indexPath.row];
    
        return cell;
        
    
    
}


- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    
    if (indexPath.row == 0) {
        
        return KScreenW / 128.0 * 48.0;
        
    } else {
        
        return KScreenW / 75.0 * 45.0;
        
        
    }
    
    
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    
    
    WineCategoryVC *temp = [[WineCategoryVC alloc]init];
    
    temp.type = @"wine";
    
    temp.seletIndex = indexPath.row;
    
    [self.navigationController pushViewController:temp animated:YES];
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}





@end
